# include <bits/stdc++.h>
using namespace std;
inline char getc() {
    static char buf[1 << 18], *fs, *ft;
    return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18,stdin)), fs == ft) ? EOF : *fs++;
}

inline int gn() {
    int k = 0, f = 1;
    char c = getc();
    for(; !isdigit(c); c = getc()) if(c == '-') f = -1;
    for(; isdigit(c); c = getc()) k = k * 10 + c - '0';
    return k * f;
}

int f[110][110], n, m, a[110];

int main() { 
# ifndef LOCAL
    freopen("flower.in", "r", stdin);
    freopen("flower.out", "w", stdout);
# endif
    n = gn(), m = gn();
    for(int i = 1; i <= n; i++) a[i] = gn();
    for(int i = 1; i <= a[1]; i++) f[1][i] = 1;
    for(int i = 1; i <= n; i++) f[i][0] = 1;
    for(int i = 2; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            for(int k = 0; k <= min(a[i], j); k++) {
                f[i][j] += f[i - 1][j - k];
                f[i][j] %= 1000007;
            }
        }
    }
    printf("%d\n", f[n][m]);
}
